package br.unisinos.ubicomp.locationawaretaskmanager;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import android.text.format.DateFormat;

import com.google.android.maps.GeoPoint;

public class Task implements Serializable {

	private static final long serialVersionUID = 1L;

	private int id;
	private String name;
	private int latitude;
	private int longitude;
	private Date date;

	// Prioritization -> Create enum

	public Task() {
		this.name = "";
	}

	public Task(String name, GeoPoint location, Date date) {
		this.name = name;
		this.latitude = location.getLatitudeE6();
		this.longitude = location.getLongitudeE6();
		this.date = date;
	}

	public void setId(int id) {
		this.id = id;
	}
	
	public int getId() {
		return this.id;
	}
	
	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return this.name;
	}

	public void setLocation(GeoPoint point) {
		this.latitude = point.getLatitudeE6();
		this.longitude = point.getLongitudeE6();
	}

	public GeoPoint getLocation() {
		GeoPoint gp = new GeoPoint(this.latitude, this.longitude);
		return gp;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Date getDate() {
		return this.date;
	}

	public String getInfo() {
		if (this.date != null) {
			SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
			return df.format(this.date);
		} else {
			return "";
		}
	}
	
	@Override
	public boolean equals(Object obj) {
		return ((Task) obj).id == this.id;
	}

}
